package com.wk.code.wkserver.service.impl;

import com.wk.code.wkserver.constant.Constant;
import com.wk.code.wkserver.service.IMailService;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.awt.image.ImageConsumer;

/**
 * @author wq
 * @date 2021-08-16 21:48
 */
@Service
public class MailServiceImpl implements IMailService {

    @Resource
    private JavaMailSender mailSender;


    @Override
    public void sendMail(String qqEmail, String content) {
        SimpleMailMessage message = new SimpleMailMessage();
        //邮件发送人
        message.setFrom(Constant.SENDER_EMAIL);
        //邮件接收人
        message.setTo(qqEmail);
        //邮件主题
        message.setSubject(Constant.WK_NAME);
        //邮件内容
        message.setText(content);
        //发送邮件
        mailSender.send(message);
    }
}
